/**
 * 项目名称: LCR_027.cpp
 * 项目路径: study/DataStructure/LinkedList/LeetCode/剑指Offer
 * 编辑时间: 2024年06月27日21时55分27秒
 * 用   户: 轻尘
 */

#include <bits/stdc++.h>

using namespace std;

struct ListNode {
    int val;
    ListNode *next;

    ListNode() : val(0), next(nullptr) {}

    ListNode(int x) : val(x), next(nullptr) {}

    ListNode(int x, ListNode *next) : val(x), next(next) {}
};

class Solution {
public:
    bool isPalindrome(ListNode* head) {
        if(!head)return false;

        ListNode * per = head;
        ListNode * result = nullptr;

        while (per){
            ListNode * p = new ListNode;
            p->val = per->val;
            p->next = result;
            result = p;
            per = per->next;
        }

        ListNode * pert = result;
        per = head;
        while (pert){
            if(per->val != pert->val)return false;
            pert = pert->next;
            per = per->next;
        }
        return true;
    }
};

int main() {

    return 0;
}
